<?php session_start();
$host = $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_NAME'] == 'localhost'){$uri="/kalender";}else{$uri="";}
if (!isset($_SESSION['id_user']) || $_SESSION['id_user']=='') {
	echo "<script language=Javascript> location.href='http://$host$uri/index.php'; </script>";	
}else{
		
	if (!is_object($bd)){	
		//me conecto a la base de datos
		require("../globals/Db.class.php");
		require("../globals/Conf.class.php");
		$bd=Db::getInstance();	
	}
	
					
	$id = $bd->san($_POST["id"]);
	$value = $bd->san($_POST["value"]);
	if ($value=='SI'){
		$query = "UPDATE archivos SET facturable = 1 where id = $id";
	}else if ($value=='NO'){
		$query = "UPDATE archivos SET facturable = 0 where id = $id";
	}
	
	
	$result = $bd->eje($query);
	if ($result){
		echo "msg:ok";	
	}else{
		echo "msg:nok";
	}	
}
?>